package com.neusoft.hifly.rpc.app.domain;

import java.io.Serializable;
import java.time.LocalDateTime;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;

import com.neusoft.hifly.commons.lang.StringConstants;

/**
 * Title: 统一用户服务
 * <p>
 * Description: 数据源 接口对象
 * <p>
 * Copyright: 2019
 * <p>
 * Company: 东软汉枫
 *
 * @author lh_neu
 * @version 1.0.0
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class DatasourceDTO implements Serializable {
	private static final long serialVersionUID = -152201381504528L;
	// 逻辑ID
	private long logicId;
	// 名称
	private String name;
	// 数据库实例名称
	private String dbName;
	// 数据库类型（ORACLE/MYSQL/SQLSERVER）
	private String dbType;
	// 数据库字符集（GBK/UTF-8）
	private String dbCharacter;
	// 数据库地址（IP/双机地址）
	private String dbUrl;
	// 数据库端口号（1521/3306）
	private String dbPort;
	// 数据库用户名称
	private String dbUser;
	// 数据库用户密码
	private String dbPassword;
	// 是否自动分配数据源(默认0否/1是)
	private int isAuto;
	// 最大租户限制
	private int dbLimit;
	// 状态(默认1启用/0停用)
	private String status;
	// 排序(降序)
	private int myOrder;
	// 备注
	private String memo;
	// 修改人
	private String updatePerson;
	// 修改时间
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonDeserialize(using = LocalDateTimeDeserializer.class)
	@JsonSerialize(using = LocalDateTimeSerializer.class)
	private LocalDateTime updateTime;

	public String getStatus() {
		if (StringUtils.isEmpty(status)) {
			status = StringConstants.YES;
		}
		return status;
	}

	public long getLogicId() {
		return logicId;
	}

	public void setLogicId(final long logicId) {
		this.logicId = logicId;
	}

	public String getName() {
		return name;
	}

	public void setName(final String name) {
		this.name = name;
	}

	public String getDbName() {
		return dbName;
	}

	public void setDbName(final String dbName) {
		this.dbName = dbName;
	}

	public String getDbType() {
		return dbType;
	}

	public void setDbType(final String dbType) {
		this.dbType = dbType;
	}

	public String getDbCharacter() {
		return dbCharacter;
	}

	public void setDbCharacter(final String dbCharacter) {
		this.dbCharacter = dbCharacter;
	}

	public String getDbUrl() {
		return dbUrl;
	}

	public void setDbUrl(final String dbUrl) {
		this.dbUrl = dbUrl;
	}

	public String getDbPort() {
		return dbPort;
	}

	public void setDbPort(final String dbPort) {
		this.dbPort = dbPort;
	}

	public String getDbUser() {
		return dbUser;
	}

	public void setDbUser(final String dbUser) {
		this.dbUser = dbUser;
	}

	public String getDbPassword() {
		return dbPassword;
	}

	public void setDbPassword(final String dbPassword) {
		this.dbPassword = dbPassword;
	}

	public int getIsAuto() {
		return isAuto;
	}

	public void setIsAuto(final int isAuto) {
		this.isAuto = isAuto;
	}

	public int getDbLimit() {
		return dbLimit;
	}

	public void setDbLimit(final int dbLimit) {
		this.dbLimit = dbLimit;
	}

	public int getMyOrder() {
		return myOrder;
	}

	public void setMyOrder(final int myOrder) {
		this.myOrder = myOrder;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(final String memo) {
		this.memo = memo;
	}

	public String getUpdatePerson() {
		return updatePerson;
	}

	public void setUpdatePerson(final String updatePerson) {
		this.updatePerson = updatePerson;
	}

	public LocalDateTime getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(final LocalDateTime updateTime) {
		this.updateTime = updateTime;
	}

	public void setStatus(final String status) {
		this.status = status;
	}
}